package com.gitee.zhengjiasen.dp.state.demo2;

import java.util.Random;

/**
 * 可以抽奖状态
 */
public class CanRaffleSate extends State {


    private Activity activity;

    // 传入一个Context对象
    public CanRaffleSate(Activity activity) {
        this.activity = activity;
    }

    @Override
    void deduceMoney() {
        System.out.println("不需要扣除积分, 已经可以开始抽奖!");
    }

    @Override
    boolean raffle() {
        System.out.println("开始抽奖...");
        int i = new Random().nextInt(10);
        if (i == 1) {
            return true;
        }
        return false;
    }

    @Override
    void dispensePrize() {
        System.out.println("还没开始抽奖, 不能发放奖品");
    }
}
